package com.aliay.sdk;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @ClassName AlipayConfig
 * @Description 支付宝支付配置
 * @Author luguanqing
 * @Date 2021/4/26 8:53
 * @Version 1.0
 */
@Component
@ConfigurationProperties(prefix = "alipay")
public class AlipayConfig {

    //应用ID，APPID
    public static String APP_ID = "2021002140644812";

    //商户私钥
    public static String APP_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgPMQtkz8G/dehZS2yNMnTWSjNHqwIWACxhqwYLKMjTtalp+R2pokpiSLZ27HyA9lyFeb0HLBrbOQueRID/nopy8doga4QWrr5QTNzu05oS4ROOE54hU7Dl4Ey3g4kPXrnKx9/USdKjDDyCpSvk+M7jJNSarXf4PL9chjBwSzXmbelVwqI/pxU3kBdVx/lDG3gXn7wjkCF/ogcniG8zCgmgUeiOK7wDsDfrMKnLx+qujHv7sUcto2Ggx3U5a0ZaNNf/DYtIdSs821xfmCfvoIFM8smFJPDfhUg+o8+xy/NDHGKxgSy/R0YtgvAsi3A0ILKzfsVYon1mV8Mb4ZaWVArAgMBAAECggEADvfeM4uvtY182RzEegMoX0/S2eZll5nw5qR36wIwcxnoPy1B0DuaUID4+nTlWIA3jcqx+le7uy0+24B/yFO7QbBBfmeuxORU1vfaQJNcra1wPIZR/jwlsWuzq/bGR2he1L1YgeIo03PpFpMadJRSA7wL/wTs3G79A+PmoCLVd4ZEj5vy5fh163/psJ4LwgUx9VdTVAzTS9gALoot5SQmKoSiFw0cwc2TNNKuiJ/ajNWDAwe+nc2E5Qo1QIHoX11tI6r+GpUBrdeP71qOLcRPoKWfiixgD4ISEAHw1T8xLRpDfx8tgpzilfHeqqER47UbQ0Y+DuPwZmfqCjX9hS2/cQKBgQDYS50ZGqOwuGawaHvMIZ7V03cbevqEgD65ZacfGIfE9w1JDK2FJGeFXs26gq+oq9qyXJ2unk0yi0WL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KMDdbmB9/cJ2bDMWV+6dnM5KtLPuLCFIzLRkBx3evYqzQtpUIItVlcJuAL/WUCNOOdaRP+t6kwNIVGcAXT5ykeKKBJ1yr3rMOnP8vcLJwJe6rIw+NLdvmeU8mKTIo8HSEHTpG1U4oRH4d/FkRipl6K8cQ7iRrQIDAQAB";

    //服务器异步通知页面路径
    public static String notify_url = "http://www.apyjpx.com";

    //页面跳转同步通知页面路径
    public static String return_url = "http://www.apyjpx.com";

    //签名方式
    public static String sign_type = "RSA2";

    //字符编码格式
    public static String CHARSET = "utf-8";

    //支付宝网管
    public static String gatewayUrl = " https://openapi.alipay.com/gateway.do";

    //日志路径
    public static String log_path = "C:\\";

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
